package doip.testRepository;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.bdware.doip.endpoint.server.DoipServer;
import org.bdware.doip.endpoint.server.DoipServerImpl;
import org.bdware.doip.endpoint.server.DoipServiceInfo;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

public class TestRepositoryMain {

    public static void main(String[] args) throws FileNotFoundException {

        Reader infoStrReader = new FileReader("./config/conf.json");

        DoipServiceInfo serviceInfo = new Gson().fromJson(infoStrReader,
                new TypeToken<DoipServiceInfo>(){}.getType());

        DoipServer server = new DoipServerImpl(serviceInfo);

        server.setRepositoryHandler(new TestRepoHandler(serviceInfo));

        server.start();

    }
}
